package capaGrafica;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
 
@SuppressWarnings("serial")
public class JImage extends JPanel {
 
	private Image imagen;
 
 
    public JImage(Image image) {
        if (image != null) {
            imagen = image;
        }
    }
 
    public void setImagen(Image newImage) {
        imagen = newImage;
 
        repaint();
    }
 
    @Override
    public void paint(Graphics g) {
        if (imagen != null) {
            g.drawImage(imagen, 0, 0, getWidth(), getHeight(),
                              this);
 
            setOpaque(false);
        } else {
            setOpaque(true);
        }
 
        super.paint(g);
    }
    public Image getImage(){
    	return imagen;
    }
    public void setImage(Image im){
    	imagen=im;
    }
}